package com.rosebud.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.rosebud.service.interf.UserService;

@Controller
public class IndexAction {
	
	@Autowired
	@Qualifier("userServiceImpl")
	private UserService userService;
	
	@RequestMapping("/sayHi")
	public String sayHello(
			@RequestParam(value = "name", required = false, defaultValue = "anonymous") String name,
			Model model) {
		model.addAttribute("name", userService.getUser(1).getUserNo());
		return "index";
	}
}
